﻿namespace OboutInc.ImageZoom
{
    using System;
    using System.Collections.Generic;

    internal class ListAdapter : IDataSourceAdapter
    {
        private readonly List<string> _view;

        internal ListAdapter(List<string> view)
        {
            this._view = view;
        }

        public object GetPagedData(int start, int end)
        {
            List<string> list = new List<string>();
            for (int i = start; (i <= end) && (i <= this.TotalCount); i++)
            {
                string item = this._view[i - 1];
                list.Add(item);
            }
            return list;
        }

        public int TotalCount
        {
            get
            {
                if (this._view != null)
                {
                    return this._view.Count;
                }
                return 0;
            }
        }
    }
}

